<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>微信登录</title>
</head>
<body>
  <div style="width: 500px;height: 420px; margin: 0 auto;padding: 0;text-align: center;">
    <div id="wechat-login-container" style="margin-top: 0px;padding: 0;display: flex;justify-content: space-between;;"></div>
  </div>
</body>
<script src="https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script>

<script type="text/javascript">
  let currentDomain = window.location.hostname;
  let redirectUrl = 'https://www.sacasaca.com/wechatloginsuccess.html'
  // if (currentDomain === 'sacasaca.com' || currentDomain === 'localhost') {
  //   redirectUrl = 'https://sacasaca.com/wechatloginsuccess.html'
  // }
   try {
            const re = new WxLogin({
            self_redirect: true, // 是否内嵌二维码，false 表示跳转
            id: "wechat-login-container", // 容器 ID
            appid: "wxcb513e3535c05a42",
            scope: "snsapi_login",
            redirect_uri: encodeURIComponent(redirectUrl), // 扫码成功后，微信会携带 code 和 state 跳转到这个地址
            state: "state",
            style: "black", // "black" or "white"
            fast_login: 1,
            href: "", // 自定义样式表的 URL
          })
      } catch (error) {
          console.error('初始化微信登录失败:', error);
  }


</script>
</html>
